package cn.iocoder.yudao.module.exam.dal.mysql.studentanswer;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.studentanswer.StudentAnswerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.studentanswer.vo.*;

/**
 * 考题管理 Mapper
 *
 * @author francis
 */
@Mapper
public interface StudentAnswerMapper extends BaseMapperX<StudentAnswerDO> {

    default PageResult<StudentAnswerDO> selectPage(StudentAnswerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentAnswerDO>()
                .eqIfPresent(StudentAnswerDO::getPaperId, reqVO.getPaperId())
                .eqIfPresent(StudentAnswerDO::getQuestionNo, reqVO.getQuestionNo())
                .eqIfPresent(StudentAnswerDO::getStudentAnswer, reqVO.getStudentAnswer())
                .eqIfPresent(StudentAnswerDO::getAiRecognizedAnswer, reqVO.getAiRecognizedAnswer())
                .eqIfPresent(StudentAnswerDO::getScore, reqVO.getScore())
                .eqIfPresent(StudentAnswerDO::getIsCorrect, reqVO.getIsCorrect())
                .eqIfPresent(StudentAnswerDO::getDeductionReason, reqVO.getDeductionReason())
                .eqIfPresent(StudentAnswerDO::getManualScore, reqVO.getManualScore())
                .eqIfPresent(StudentAnswerDO::getManualComment, reqVO.getManualComment())
                .eqIfPresent(StudentAnswerDO::getMarkedBy, reqVO.getMarkedBy())
                .orderByDesc(StudentAnswerDO::getId));
    }

}